﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Class4.EvenNumber();
            Console.Read();
        }
        static void nn()
        {
            Console.WriteLine("输入字符串：");
            string str = Console.ReadLine();
            int lettercount = 0;
            int Isdigitcount = 0;
            int spacecount = 0;
            foreach (var item in str)
            {
                if (char.IsLetter(item))
                {
                    lettercount++;
                }
                else if (char.IsDigit(item))
                {
                    Isdigitcount++;
                }
                else if (char.IsWhiteSpace(item))
                {
                    spacecount++;
                }
            }
            Console.WriteLine("英文字母数：{0} 数字数：{1} 空格数：{2} ", lettercount, Isdigitcount, spacecount);


        }
        static void mm()
        {
            //在 Main 方法中创建一个 double 类型的数组，并在该数组中存入 5 名学生的考试成绩(控制台输入)，
            //计算总成绩和平均成绩。
            //要求使用foreach语句实现该功能，
            double[] score = new double[5];
            Console.WriteLine("输入学生成绩：");
            double sum = 0;

            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine("输入第" + (i + 1) + "位学生成绩：");
                score[i] = double.Parse(Console.ReadLine());
            }
            foreach (var item in score)
            {
                sum += item;
            }
            Console.WriteLine("总成绩：" + sum + "平均成绩：" + (sum / 5));

        }
        static void oo()
        {

            //定义一个方法，实现一维数组的排序功能，从大到小排序。(不要用Array类的方法)
            int[] arr = new int[] { 45, 12, 98, 66 };
            for (int i = 0; i < arr.Length; i++)
            {
                for (int j = 0; j < arr.Length - 1 - i; j++)
                {
                    if (arr[j] < arr[j + 1])
                    {
                        int temp = arr[j];
                        arr[j] = arr[j + 1];
                        arr[j + 1] = temp;
                    }
                }
            }
            Console.WriteLine(arr[0] + "," + arr[1] + "," + arr[2] + "," + arr[3]);

        }
        static void jiu()
        {
            for (int i = 1; i < 9; i++)
            {
                for (int j = 1; j < 9; j++)
                {
                    Console.Write(i + "*" + j + "=" + i * j + "\t");
                }
            }
            Console.WriteLine();
        }
        static void ii()
        {
            //定义一个数组，然后控制台输入要查找的元素，返回输入值在数组中di一次出现的位置。
            //若是找不到，请打印找不到。(不要用Array类的方法)
            int[] num = new int[] { 1, 2, 3, 4, 4, 5, 3 };
            Console.WriteLine("输入要查找的元素：");
            for (int i = 0; i < num.Length; i++)
            {
                Console.Write(num[i] + ",");
            }
            int top = -1;
            int num1 = int.Parse(Console.ReadLine());

            for (int i = 0; i < num.Length; i++)
            {
                if (num1 == num[i])
                {
                    top = i;
                }

            }
            if (top != 0)
            {
                Console.WriteLine(top);
            }
            else
            {
                Console.WriteLine("找不到该元素！");
            }



        }
        static void zf()
        {

            Console.WriteLine("输入正方形边长：");
            int num = int.Parse(Console.ReadLine());
            for (int i = 1; i <= num; i++)
            {
                for (int j = 1; j <= num; j++)
                {
                    if (i == 1 || i == num || j == 1 || j == num)
                    {
                        Console.Write(" *");
                    }
                    else
                    {
                        Console.Write("  ");
                    }
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
        static void zf2()
        {

            Console.WriteLine("输入正方形的边长：");
            int num = int.Parse(Console.ReadLine());
            for (int i = 1; i <= num; i++)
            {
                for (int j = 1; j <= num; j++)
                {
                    Console.Write(" * ");
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
static void nk() {
            int[] arr = new int[5];
            for (int i = 0; i < arr.Length; i++)
            {
                Console.WriteLine("请输入第" + (i + 1) + "个数：");
                arr[i] = int.Parse(Console.ReadLine());
            }
            int[] arr1 = new int[6];
            for (int i = 0; i < arr.Length; i++)
            {
                arr1[i] = arr[i];
            }
            Console.WriteLine();
            for (int i = 0; i < arr1.Length; i++)
            {
                if (arr1[i] == 0)
                {
                    Console.WriteLine("请再输入一个数：");
                    arr1[i] = int.Parse(Console.ReadLine());
                    break;
                }
            }
            Console.WriteLine("排序前的结果为:");
            foreach (int num in arr1)
            {
                Console.Write(num + " ");
            }

            for (int i = 0; i < arr1.Length; i++)
            {
                for (int j = 0; j < arr1.Length - i - 1; j++)
                {
                    if (arr[j] < arr1[j + 1])
                    {
                        int temp = arr1[j];
                        arr1[j] = arr1[j + 1];
                        arr1[j + 1] = temp;
                    }
                }
            }
            Console.WriteLine();
            Console.WriteLine("排序后的结果为:");
            foreach (int num in arr1)
            {
                Console.Write(num + " ");
            }
        }


    }
}
